FastAPI Pydantic This code defines a FastAPI endpoint to create a new item. It uses Pydantic for data validation and SQLAlchemy ORM for database interactions. FastAPI Endpoint 2024-12-16 12:17:39 24 views
Python random The function generates a list of random strings where the number of items in the list is specified by the `num_items` parameter, and the maximum length of each string is specified by the `max_length` parameter (default is 10). The function internally uses the `random` and `string` standard libraries to generate random strings. Python Function 2024-12-16 12:17:11 14 views
Freezegun This function uses the Freezegun library to freeze time and then performs a random operation on each item of a list. Python Function 2024-12-16 12:15:47 11 views
Scrapy Item This function uses Scrapy's Item Loaders to extract data from a response object and randomly modifies one of its attributes. Scrapy Item Loader Function 2024-12-16 12:15:37 22 views
Python built-in This function generates a list of random strings with a specified number of items. The type of code 2024-12-16 12:15:03 8 views
FastAPI Pydantic This code defines a FastAPI application that contains a POST endpoint for calculating the discounted price of an item. The user needs to provide the item's name and price, as well as the discount rate. FastAPI API Endpoint 2024-12-16 12:14:39 8 views
Scrapy This function extracts unique item titles from a Scrapy spider's response. It uses CSS selectors to locate elements and a set to ensure the uniqueness of the titles. Scrapy crawler handler 2024-12-16 12:14:23 6 views
FastAPI Pydantic This function takes a dictionary containing item information, parses it into an `Item` model, and then calls the `create_item` function to create the item. If there is a validation error during parsing, it raises an HTTP exception. FastAPI custom function 2024-12-16 12:14:18 6 views
Scrapy This function is used to extract item title, price, and description from a Scrapy response object. Scrapy crawler parsing function 2024-12-16 12:13:52 5 views
FastAPI Pydantic This function creates an item using FastAPI and Pydantic, handling exceptions that may occur during the item creation process. It accepts a Pydantic model containing item information and returns the created item. If an exception occurs during item creation, it raises an HTTP exception. FastAPI Function 2024-12-16 12:13:40 6 views